package com.csun.cmny.provider.model.enums.csunsleep;

import java.util.Arrays;
import java.util.List;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-08-08 09:41
 * @Description:
 */
public enum DmcCsunSleepFuncEnum {

    /*
     * 离线报警
     */
    OFF_LINE("off_line", "离线报警"),

    /**
     * 离床报警
     */
    OFF_BED("off_bed", "离床报警"),;

    /**
     * The Key.
     */
    String key;
    /**
     * The Value.
     */
    String value;

    DmcCsunSleepFuncEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }

    /**
     * Gets key.
     *
     * @return the key
     */
    public String getKey() {
        return key;
    }

    /**
     * Gets value.
     *
     * @return the value
     */
    public String getValue() {
        return value;
    }

    /**
     * 获取key获取value
     *
     * @param key key
     *
     * @return value value
     */
    public static String getValue(String key) {
        for (DmcCsunSleepFuncEnum ele : DmcCsunSleepFuncEnum.values()) {
            if (key.equals(ele.getKey())) {
                return ele.getValue();
            }
        }
        return null;
    }

    /**
     * 根据key获取该对象
     *
     * @param key key
     *
     * @return this enum
     */
    public static DmcCsunSleepFuncEnum getEnum(String key) {
        for (DmcCsunSleepFuncEnum ele : DmcCsunSleepFuncEnum.values()) {
            if (key.equals(ele.getKey())) {
                return ele;
            }
        }
        return null;
    }

    /**
     * 获取List集合
     *
     * @return List list
     */
    public static List<DmcCsunSleepFuncEnum> getList() {
        return Arrays.asList(DmcCsunSleepFuncEnum.values());
    }

}
